import {
    legacy_createStore,
    applyMiddleware
} from 'redux'
import {ALLACTION,SETLIST,ALLSTATE,SETLISTACTIONTYPE} from '../types/store.d'

import logger from 'redux-logger'
import thunk from 'redux-thunk'


const initialState = {
    list:[]
}

const reducer = (state:ALLSTATE = initialState, { type, payload }:ALLACTION) => {
  switch (type) {

  case SETLIST:
    state.list = payload
    return { ...state}

  default:
    return state
  }
}

const store = legacy_createStore(reducer,applyMiddleware(logger,thunk))

export default store
